package com.tedu;

import java.util.Random;

public class Test007 {
    public static void main (String[] args) {
        int[] a = new int[5];
        System.out.println(a[0]);
//        double[] b = new double[5];
//        System.out.println(b[0]);
//
//        char[] c = new char[5];
//        System.out.println(c[0]);
        boolean d[] = new boolean[5];
        System.out.println(d[0]);
//  2   d[2]==false  d[2]==true
//  3  d[3]==false  d[3]==true
//  2   d[2]==true
//

        Random random = new Random();
        int index = 0;  //1 2 3 4 5   //a[0]=4 a[1]=2 a[2]=0 a[3]=1 a[4]=3
        while (true) {
            int i = random.nextInt(5); //  4 2 0 1 3
            if (d[i] == false) {
                a[index] = i;
                index++;
                d[i] = true;
            }
            if (index == a.length) {
                break;
            }
        }


        for (int i = 0; i < a.length; i++) {
            System.out.println("a[i] = " + a[i]);
        }
    }
}
